<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
use think\Request;
use think\Session;

class Manage2 extends  Controller{


    public  function  manage2(){
//        echo 1;exit;
        $res =  Request::instance();
        $url = $res ->root(true);


        $username = Session::get('username');

        if(!empty($username)){

            $arr5 = Db::name('gp')->select();

//            var_dump($arr5);
            return view('manage2',compact('url','arr5'));


        }else{
            $this->success('请先登录',"{$url}/admin/users/users");
        }


//        return view('manage');


//        return view('manage');

    }


    public  function deit(){


        $user = Session::get('username');
        $res =  Request::instance();
        $url = $res ->root(true);
        if(!empty($user)){

            $id = input('get.id');

            $arr = ['id'=>$id];


            $bool = Db::name('gp')->where($arr)->delete();
            $sql = Db::name('gp')->getLastSql();

            echo $sql;exit;

            if($bool){
                $this->success('删除成功');
            }


//            echo $id;exit;


        }else{


            $this->success('请先登录',"{$url}/admin/users/users");
        }




    }

}